package com.zzb.controller;

import com.zzb.DTO.ResultDTO;
import com.zzb.VO.UserVO;
import com.zzb.service.UserService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author ASUS
 */
@RestController
@CrossOrigin(allowCredentials = "true", origins = {"http://localhost:63342"})
public class LoginController {

    @Resource
    private UserService userService;

    @PostMapping("/login")
    public ResultDTO login(UserVO userVO, HttpServletRequest request) {
        String id = request.getSession().getId();
        return userService.login(userVO, id);
    }
}